#include "Input.hpp"
#include "Utils/Exceptions.hpp"

namespace red{
	Input::Input() : mInputs(0), mWheelPos(0){
	}

	void Input::Initialize(Window &pWindow){
		mInputs = &pWindow.GetInput();
		mWindow = &pWindow;
	}

	bool Input::GetEvents(){
		return mWindow->GetEvent(mEvents);
	}

	void Input::AddMouseBinding(const std::string &pName, sf::Event::EventType pEvent, MouseButton pButton){
		InputBind iB;
		iB.mEventType = pEvent;
		iB.mInputType = IT_Mouse;
		iB.mMouseButton = pButton;
		mInputBinds.insert(std::pair<std::string, InputBind>(pName, iB));
	}

	void Input::AddKeyBinding(const std::string &pName, sf::Event::EventType pEvent, Key pKey){
		InputBind iB;
		iB.mEventType = pEvent;
		iB.mInputType = IT_Mouse;
		iB.mKeyCode = pKey;
		mInputBinds.insert(std::pair<std::string, InputBind>(pName, iB));
	}
}
